<template>
    <div>
        <el-card class="!border-none mb-4" shadow="never">
            <el-form class="mb-[-16px]" :model="queryParams" inline>
                <el-form-item label="订单编号" prop="sn">
                    <el-input class="w-[280px]" v-model="queryParams.sn" clearable placeholder="请输入订单编号" />
                </el-form-item>
                <el-form-item label="商户" prop="merchant_id">
                    <el-input class="w-[280px]" v-model="queryParams.merchant_id" clearable placeholder="请输入商户" />
                </el-form-item>
                <el-form-item label="说明" prop="remark">
                    <el-input class="w-[280px]" v-model="queryParams.remark" clearable placeholder="请输入说明" />
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="resetPage">查询</el-button>
                    <el-button @click="resetParams">重置</el-button>
                </el-form-item>
            </el-form>
        </el-card>
        <el-card class="!border-none" v-loading="pager.loading" shadow="never">
            <div class="mt-4">
                <el-table :data="pager.lists" @selection-change="handleSelectionChange">
                    <el-table-column type="selection" width="55" />
                    <el-table-column label="订单编号" prop="sn" show-overflow-tooltip />
                    <el-table-column label="商户" prop="merchant.name" show-overflow-tooltip />
                    <el-table-column label="金额" prop="amount" show-overflow-tooltip />
                    <el-table-column label="说明" prop="remark" show-overflow-tooltip />

                </el-table>
            </div>
            <div class="flex mt-4 justify-end">
                <pagination v-model="pager" @change="getLists" />
            </div>
        </el-card>
    </div>
</template>

<script lang="ts" setup name="commissionLogLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import { apiCommissionLogLists } from '@/api/merchantcenter'




// 查询条件
const queryParams = reactive({
    sn: '',
    merchant_id: '',
    remark: ''
})

// 选中数据
const selectData = ref<any[]>([])

// 表格选择后回调事件
const handleSelectionChange = (val: any[]) => {
    selectData.value = val.map(({ id }) => id)
}

// 获取字典数据
const { dictData } = useDictData('')

// 分页相关
const { pager, getLists, resetParams, resetPage } = usePaging({
    fetchFun: apiCommissionLogLists,
    params: queryParams
})




getLists()
</script>
